const sessionStorage = window.sessionStorage
export class Auth {
  static setUserInfo (value = {}) {
    return sessionStorage.setItem('user.userInfo', JSON.stringify(value))
  }

  static getUserInfo () {
    const userInfo = sessionStorage.getItem('user.userInfo')
    return userInfo ? JSON.parse(userInfo) : {}
  }

  static removeUserInfo () {
    return sessionStorage.removeItem('user.userInfo')
  }

  static setAccountRemember (value = {}) {
    return localStorage.setItem('user.accountRemember', JSON.stringify(value))
  }

  static getAccountRemember () {
    const accountRemember = localStorage.getItem('user.accountRemember')
    return accountRemember ? JSON.parse(accountRemember) : null
  }

  static removeAccountRemember () {
    return localStorage.removeItem('user.accountRemember')
  }

  static setLogin () {
    return sessionStorage.setItem('isLogin', true)
  }

  static getLogin () {
    return sessionStorage.getItem('isLogin')
  }

  static removeLogin () {
    return sessionStorage.removeItem('isLogin')
  }
}
